$(function () {
    $('.emotion').qqFace({
        id: 'facebox',
        assign: 'picture-title',
        path: "/static/img/emoj/"	//表情存放的路径
    });

    $("form").submit(function (e) {
        var str = $("#picture-title").val();
        $("#picture-title").val(replace_em(str));
    });

    function replace_em(str) {
        /*  str = str.replace(/\</g, '&lt;');
          str = str.replace(/\>/g, '&gt;');
          str = str.replace(/\n/g, '<br/>');*/
        str = str.replace(/\[em_([0-9]*)\]/g, '<img src="/static/img/emoj/$1.gif" border="0" />');
        return str;
    }

});